package cn.huixh.blindbox.config;

import cn.huixh.blindbox.intercept.TokenInterceptor;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

import javax.annotation.Resource;

/**
 * @author huixh
 * @version 1.0
 * @date 2022/5/9 13:55
 */
//@Configuration
public class InterceptorConfig implements WebMvcConfigurer {
    /**
     * 拦截器实例
     */
    @Resource
    private TokenInterceptor tokenInterceptor;

    /**
     * token 拦截器
     *
     * @param registry registry
     */
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(tokenInterceptor)
                .addPathPatterns("/**")
                .excludePathPatterns("/login/**")
                .excludePathPatterns("/BlindBox/**");

    }
}
